cwd = '$1'
binaries = `find $cwd -name "*.0.0.*.bc"`
for binary in $(echo "$binaries"); do

    echo "($STEP) Constructing CG for $binary.."
    prefix="$TMPDIR/dot-files/$(basename $binary)"
    while ! opt -dot-callgraph $binary.0.0.*.bc -callgraph-dot-filename-prefix $prefix >/dev/null 2> $TMPDIR/step${STEP}.log ; do
    echo -e "\e[93;1m[!]\e[0m Could not generate call graph. Repeating.."
    done

    #Remove repeated lines and rename
    awk '!a[$0]++' $(basename $binary).callgraph.dot > callgraph.$(basename $binary).dot
    rm $(basename $binary).callgraph.dot
done

#Integrate several call graphs into one
$AFLGO/merge_callgraphs.py -o callgraph.dot $(ls callgraph.*)
echo "($STEP) Integrating several call graphs into one."